package 结构型模式.适配器模式;

public class MediaPlayerAdapter implements IMediaPlayer {

	IAdvancedMediaPlayer musicPlayer;

	public MediaPlayerAdapter(String audioType) {
		if (audioType.equalsIgnoreCase("vlc")) {
			musicPlayer = new VlcPlayerImpl();
		} else if (audioType.equalsIgnoreCase("mp4")) {
			musicPlayer = new Mp4PlayerImpl();
		}
	}

	@Override
	public void play(String audioType, String fileName) {
		if (audioType.equalsIgnoreCase("vlc")) {
			musicPlayer.playVlc(fileName);
		} else if (audioType.equalsIgnoreCase("mp4")) {
			musicPlayer.playMp4(fileName);
		}
	}
}